package chamber.one.thread;

import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Inject;

/**
 * Created by Gerardo on 12/9/13.
 */
public class ToDividedByThreeSumAsyncFunction implements AsyncFunction<Integer, Integer> {
    private final ToDividedByThreeSumFunction toDividedByThreeSum;

    @Inject
    public ToDividedByThreeSumAsyncFunction(final ToDividedByThreeSumFunction toDividedByThreeSum) {
        this.toDividedByThreeSum = toDividedByThreeSum;
    }

    @Override
    public ListenableFuture<Integer> apply(Integer input) throws Exception {
        return Futures.immediateFuture(toDividedByThreeSum.apply(input));
    }
}
